
function quit() {
	$.ajax({
		url : "/Blog/quit",
		data : {},
		type : "post",
		datatype : "html",
		success : function() {
			window.location.href = "index.jsp";
		}
	});
}
function likeArticle(articleId, userId) {
	if (userId == 0) {
		alert("请先登录");
		window.location.href = "login.html";
		return;
	}
	$.ajax({
		url : "/Blog/like",
		data : {
			articleId : articleId,
			userId : userId
		},
		type : "post",
		datatype : "text",
		success : function(result) {
			var id = "likeArticle" + articleId;
			if (result == "add") {
				document.getElementById(id).innerHTML = document.getElementById(id).innerHTML * 1 + 1;
			} else if (result == "cancel") {
				document.getElementById(id).innerHTML = document.getElementById(id).innerHTML * 1 - 1;
			}
		}
	});

}
function dislikeArticle(articleId, userId) {
	if (userId == 0) {
		alert("请先登录");
		window.location.href = "login.html";
		return;
	}
	$.ajax({
		url : "/Blog/dislike",
		data : {
			articleId : articleId,
			userId : userId
		},
		type : "post",
		datatype : "text",
		success : function(result) {
			var id = "dislikeArticle" + articleId;
			if (result == "add") {
				document.getElementById(id).innerHTML = document.getElementById(id).innerHTML * 1 + 1;
			} else if (result == "cancel") {
				document.getElementById(id).innerHTML = document.getElementById(id).innerHTML * 1 - 1;
			}
		}
	});

}
function edit(articleId) {
	// window.location.href="edit.jsp";
	$.ajax({
		url : "/Blog/edit",
		data : {
			articleId : articleId
		},
		type : "post",
		datatype : "text",
		success : function() {
			window.location.href = "edit.jsp";
		}
	});
}
